package fr.xebia.monitoring.export.servlet;

import javax.servlet.http.HttpServlet;

import fr.xebia.monitoring.MeasureHandler;
import fr.xebia.monitoring.MonitorFactory;
import fr.xebia.monitoring.beans.AggregatedMeasures;

public abstract class AbstractMeasureAwareServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;
	private MeasureHandler measureHandler;

	protected AggregatedMeasures getAggregatedMeasures() {
		if (measureHandler == null) {
			measureHandler = MonitorFactory.getMeasureHandler();
			if (measureHandler == null) {
				return new AggregatedMeasures();
			}
		}
		AggregatedMeasures measures = measureHandler.getAggregatedMeasures();
		return measures;
	}
}
